package org.jluzh.registUsingHibernate.action;

import org.hibernate.Session;

import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.jluzh.registUsingHibernate.domain.User;
import org.jluzh.registUsingHibernate.service.UserService;

import com.opensymphony.xwork2.ActionSupport;

public class regist extends ActionSupport
{
    private User user;

    public User getUser()
    {
	return user;
    }

    public void setUser(User user)
    {
	this.user = user;
    }

    @Override
    public String execute() throws Exception
    {
	System.out.println(user.getUsername());
	UserService userService = new UserService();
	if (user.getId() > 0)
	{
	    userService.CreateUser(user);
	    return SUCCESS;
	}
	return ERROR;
    }
}
